package com.zkq.graduate.conf;


import com.alibaba.druid.support.http.StatViewServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author zhangkaiqiang
 * @Date 2019/2/11  14:06
 * @Description TODO
 */
@Configuration
public class DruidConfig {

    @Bean
    public ServletRegistrationBean statViewServlet(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid/*");
        Map<String,String> initParam=new HashMap<>();
        initParam.put("loginUsername","root");
        initParam.put("loginPassword","root");
        initParam.put("allow","127.0.0.1");
        initParam.put("resetEnable","false");
        servletRegistrationBean.setInitParameters(initParam);
        return servletRegistrationBean;
    }
}
